package com.qianbei.view.errotip;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;

import com.qianbei.R;
import com.qianbei.bean.GetErroBean;
import com.qianbei.bean.GetErroBean1;
import com.qianbei.common.base.BaseActivity;
import com.qianbei.common.net.control.ServerControl;
import com.qianbei.common.net.control.ServerResult;
import com.qianbei.common.net.okhttp.RequeastBean;
import com.qianbei.common.net.view.MsgAlert;
import com.qianbei.common.net.view.ProgressDialog;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TactionActivity extends BaseActivity {


    @Bind(R.id.taction_et)
    EditText tactionEt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gufei_erro_acitivty3);
        ButterKnife.bind(this);
        setTitle("牵引费");
    }






    @OnClick(R.id.taction_save)
    public void onViewClicked() {
        if(TextUtils.isEmpty( tactionEt.getText().toString())){
            new MsgAlert().show("请输入牵引费");
        }else {
            interrupt(tactionEt.getText().toString());
        }

    }


    /**
     * 上报 异常报警 - 车辆满载
     */
    private void interrupt(String money) {

        ServerControl sc = new ServerControl(
                new RequeastBean("interrupt", "com.cygps.dubbo.WasteTransport.IRouteInfo",
                        new GetErroBean1("2",money)));
        sc.serverListener = new ServerControl.ServerListener() {

            @Override
            public void serverFinish(ServerResult sr) {
                if (sr.isContinue) {
                    new MsgAlert().show("上报成功");
                    finish();
                }

            }
        };
        new ProgressDialog(mContext).OKpost(sc);
    }
}
